package com.bwie.controller;
import com.bwie.pojo.Brand;
import com.bwie.service.BrandService;
import com.bwie.service.Impl.BrandServiceImpl;
import com.bwie.utils.R;
import com.bwie.vo.PageInfoVo;
import org.springframework.web.bind.annotation.*;

import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
* 品牌表(tb_brand)表控制层
*
* @author xxxxx
*/
@RestController
@RequestMapping("/shop/brand")
public class BrandController {
/**
* 服务对象
*/
    @Autowired
    private BrandService brandService;

    /**
     * 获取品牌列表
     * @param pageInfoVo
     * @return
     */
    @PostMapping("/getBrandList")
    public R getBrandList(
            @RequestBody PageInfoVo pageInfoVo
            ){
        return brandService.getBrandList(pageInfoVo);
    }

    /**
     * 添加品牌
     * @param brand
     * @return
     */
    @PostMapping("/addBrand")
    public R addBrand(
        @RequestBody Brand brand
    ){
        return brandService.addBrand(brand);
    }

    /**
     * 修改状态
     * @param brand
     * @return
     */
    @PostMapping("/updateBrandStatus")
    public R updateBrandStatus(
        @RequestBody Brand brand
    ){
        return brandService.updateBrandStatus(brand);
    }

    /**
     *删除数据
     * @param brandId
     * @return
     */
    @PostMapping("/dateBrand/{brandId}")
    public R dateBrand(
        @PathVariable("brandId") Integer brandId
    ){
        return brandService.dateBrand(brandId);
    }

    /**
     * 批量删除
     * @param brandList
     * @return
     */
    @PostMapping("/deteBrandIds")
    public R deteBrandIds(
        @RequestBody  List<Brand> brandList
    ){
        return brandService.deteBrandIds(brandList);
    }
}
